#include <Arduino.h>
#include <WiFi.h>
#include <Wire.h>

#include "Adafruit_ILI9341.h"


#define BTN_PIN 5
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

//const char *ssid="Wokwi-GUEST";
//const char *password="";
const char *ssid="Xiaomi_5C2D";
const char *password="82370288";
void setup() {
    Serial.begin(115200);

    tft.begin();
    tft.setRotation(1);

    tft.setTextColor(ILI9341_WHITE);
    tft.setTextSize(2);

    tft.print("Connecting to WiFi");
    Serial.print("Connecting to WiFi");

    WiFi.begin(ssid, password, 6);
    while (WiFi.status() != WL_CONNECTED) {
        delay(100);
        Serial.print(".");
        tft.print(".");
    }
    tft.println();
    Serial.println(" Connected!");
    tft.println("Connected!");

    Serial.println(WiFi.localIP().toString());
    tft.println(WiFi.localIP().toString());

}

void loop() {
    delay(100); // TODO: Build something amazing!
}